package com.jiangxjsy.crm.controller;

import com.alibaba.fastjson.JSONObject;
import com.jiangxjsy.core.page.BasePage;
import com.jiangxjsy.core.wrap.Result;
import com.jiangxjsy.core.wrap.ResultBuilder;
import com.jiangxjsy.crm.service.CrmBackLogDealService;
import com.jiangxjsy.model.crm.bo.CrmBackLogBO;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * wukong-crm-master
 * 蒋胜宇
 * 2025/6/16 14:14
 */

@RestController
@RequestMapping("/crmBackLog")
public class CrmBackLogDealController {
    @Resource
    private CrmBackLogDealService crmBackLogDealService;

    /**
     * 查询待办事项数量
     *
     * @return 待办事项数量
     */
    @PostMapping("/num")
    public Result<JSONObject> num(HttpServletRequest request, HttpServletResponse response) {
        JSONObject num = crmBackLogDealService.num(request, response);
        return ResultBuilder.ok(num);
    }

    /**
     * 今日需联系线索
     *
     * @param crmBackLogBO crmBackLogBO
     * @return BasePage<Map<String, Object>>
     */
    @PostMapping("/todayLeads")
    public Result<BasePage<Map<String, Object>>> todayLeads(@RequestBody CrmBackLogBO crmBackLogBO, HttpServletRequest request, HttpServletResponse response) {
        BasePage<Map<String, Object>> basePage = crmBackLogDealService.todayLeads(crmBackLogBO, request, response);
        return ResultBuilder.ok(basePage);
    }
}
